package com.lc202309;

/**
 * Description:
 *
 * @Create 2023/8/31 23:21
 * @Version 1.0
 */
public class Solution35 {
    public int searchInsert(int[] nums, int target) {
        int length = nums.length;
        for (int i = 0; i < length; i++) {
            if (target <= nums[i]) {
                return i;
            }
            if (i == length - 1) {
                return length;
            }
            if(nums[i+1]>=target){
                return i+1;
            }

        }
        return 0;
    }
}
